package com.CoreryBlack.exception;


import com.CoreryBlack.po.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler({Exception.class,RuntimeException.class})

    public Result doException(Exception e){

        log.error("发生异常：{}",e.getMessage());

        e.printStackTrace();

        return Result.error("服务器繁忙，请稍后重试");
    }
}
